In [1]:
# Load the PANOPTES module dir
import sys
sys.path.append('../..')

import astropy.units as u
from astropy.time import Time
from astropy.coordinates import SkyCoord

import time

# For development
%load_ext autoreload
%autoreload 2

In [2]:
from panoptes import Panoptes


INFO:PanoptesLogger:Adding warning logging to: PanError
INFO:PanoptesLogger:Adding warning logging to: SerialData
INFO:PanoptesLogger:Adding warning logging to: Target
INFO:PanoptesLogger:Adding warning logging to: Observation
INFO:PanoptesLogger:Adding warning logging to: Scheduler
INFO:PanoptesLogger:Adding warning logging to: Observatory
INFO:PanoptesLogger:Adding warning logging to: Panoptes

In [3]:
pan = Panoptes()


INFO:Panoptes:********************************************************************************
INFO:Panoptes:Initializing PANOPTES unit
INFO:Panoptes:Checking config
INFO:Panoptes:Welcome PAN 001
INFO:Panoptes:Setting up database connection
INFO:Panoptes:Setting up observatory
INFO:Observatory:Initializing observatory
INFO:Observatory:	 Setting up observatory details
INFO:Observatory:Setting up site details of observatory
INFO:Observatory:	 Setting up mount
INFO:Observatory:Creating mount: ioptron
INFO:PanoptesLogger:Adding warning logging to: AbstractMount
INFO:PanoptesLogger:Adding warning logging to: Mount
INFO:Mount:Creating iOptron mount
INFO:Mount:Setting up commands for mount
INFO:Mount:Loading mount commands file: /var/panoptes/POCS/resources//conf_files/mounts/ioptron.yaml
INFO:Mount:Mount commands updated from /var/panoptes/POCS/resources//conf_files/mounts/ioptron.yaml
INFO:Mount:Mount commands set up
INFO:SerialData:SerialData created
INFO:Mount:Mount created
INFO:Observatory:	 Setting up cameras
INFO:Observatory:	 Setting up scheduler

In [4]:
mount = pan.observatory.mount
mount.is_initialized = False
mount.initialize()


INFO:Mount:Initializing panoptes.mount.ioptron mount
INFO:Mount:Connecting to mount
INFO:Mount:Making serial connection for mount at /dev/ttyUSB0
INFO:SerialData:Serial connect called
INFO:SerialData:Serial connection established to mount
INFO:Mount:Mount connected via serial
INFO:Mount:Mount connected: True
INFO:Mount:Mount Query & Params: version None
INFO:Mount:Mount Query & Params: mount_info None
INFO:Mount:Setting up mount for location
INFO:Mount:Mount Query & Params: set_long -560088 arcsec
INFO:Mount:Mount Query & Params: set_lat +070344 arcsec
INFO:Mount:Mount Query & Params: disable_daylight_savings None
INFO:Mount:Mount Query & Params: set_gmt_offset -600
INFO:Mount:Mount Query & Params: set_local_time 093214
INFO:Mount:Mount Query & Params: set_local_date 150820
INFO:Mount:Mount initialized: True
Out[4]:
True

In [53]:
mount.unpark()
mount.slew_to_home()


INFO:Mount:Mount Query & Params: unpark None
INFO:Mount:Mount unparked
INFO:Mount:Mount Query & Params: goto_home None
Out[53]:
'1'

In [50]:
mount.park()


INFO:Mount:Park Coordinates RA-Dec: <SkyCoord (ICRS): (ra, dec) in deg
    (297.47284138, 1.0)>
INFO:Mount:Mount Query & Params: set_ra 71393482
INFO:Mount:Mount Query & Params: set_dec +0360000
INFO:Mount:Mount Query & Params: park None
Out[50]:
'1'

Now that we have tested that it is working, let's try to slew around to a few different targets in various locations and then move back to park.

Note: I am picking targets that are available for me right now.


In [51]:
mount.set_target_coordinates(SkyCoord.from_name('Sirius'))


INFO:Mount:Mount Query & Params: set_ra 24308917
INFO:Mount:Mount Query & Params: set_dec -6017802
Out[51]:
True

In [52]:
mount.unpark()
mount.slew_to_target()


INFO:Mount:Mount Query & Params: unpark None
INFO:Mount:Mount unparked
INFO:Mount:Mount Query & Params: slew_to_target None
Out[52]:
'1'

In [31]:
mount.status()


INFO:Mount:Mount Query & Params: get_status None
Out[31]:
{'gps': 'On',
 'hemisphere': 'Northern',
 'movement_speed': '64x sidereal',
 'system': 'Slewing',
 'time_source': 'RS-232',
 'tracking': 'Sidereal'}

In [32]:
mount.is_parked


Out[32]:
False

We notice that our coordinates stayed the same after we issued park command. That is because the park command is non-blocking, so it issued the command but then immediately reported the coordinates.

Let's try tracking Regulus through the meridian


In [47]:
mount.set_target_coordinates(SkyCoord.from_name('Regulus'))


INFO:Mount:Mount Query & Params: set_ra 36502311
INFO:Mount:Mount Query & Params: set_dec +4308195
Out[47]:
True

In [48]:
mount.unpark()
mount.slew_to_target()


INFO:Mount:Mount Query & Params: unpark None
INFO:Mount:Mount unparked
INFO:Mount:Mount Query & Params: slew_to_target None
Out[48]:
'1'

In [42]:
mount.status()


INFO:Mount:Mount Query & Params: get_status None
Out[42]:
{'gps': 'On',
 'hemisphere': 'Northern',
 'movement_speed': '64x sidereal',
 'system': 'Tracking (PEC disabled)',
 'time_source': 'RS-232',
 'tracking': 'Sidereal'}

In [43]:
mount.slew_to_home()


INFO:Mount:Mount Query & Params: goto_home None
Out[43]:
'1'